cmake_minimum_required(VERSION 2.8)

project(zcc_json)

set(my_compile_definitions
    "-D_GNU_SOURCE"
    "-g" "-ggdb"
    "-O2"
    "-Wall"
    "-Winline"
    "-Wno-dev"
)

set(CMAKE_CXX_FLAGS "-std=gnu++11")

INCLUDE_DIRECTORIES(
    ./
)

set(ALL_LIB_SOURCES
    zcc_json.cpp
)

FILE(GLOB ALL_TEST_FILES "*_test.cpp")

foreach(test_cpp  ${ALL_TEST_FILES})
  string(REGEX REPLACE ".*/(.*)" "\\1" test_cpp_name ${test_cpp})
  string(REGEX REPLACE ".cpp$" "" test_bin ${test_cpp_name})
  add_executable(${test_bin} ${test_cpp_name} ${ALL_LIB_SOURCES})
  set_target_properties(${test_bin} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/)
endforeach()
